package com.soriya.nestlive.controller;

import com.soriya.nestlive.entity.param.LoginParam;
import com.soriya.nestlive.entity.vo.InfoVo;
import com.soriya.nestlive.service.AdminService;
import com.soriya.nestlive.util.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/sys")
public class AdminController {

    private final AdminService adminService;

    @Autowired
    public AdminController(AdminService adminService) {
        this.adminService = adminService;
    }

    @PostMapping("/login")
    public Result<?> login(@RequestBody LoginParam loginParam) {
        String token = adminService.login(loginParam);
        return Result.success(token);
    }

    @GetMapping("/info")
    public Result<?> getInfo() {
        InfoVo info = adminService.getInfo();
        return Result.success(info);
    }

}
